#!/bin/bash

# 启动简化版认证服务（不包含Spring Cloud Alibaba组件）

echo "=== 启动简化版认证服务 ==="
echo

# 检查Java版本
echo "检查Java版本..."
java -version
echo

# 编译项目
echo "编译项目..."
mvn clean compile -pl auth-service -am
if [ $? -ne 0 ]; then
    echo "❌ 编译失败"
    exit 1
fi
echo "✅ 编译成功"
echo

# 启动简化版服务
echo "启动简化版认证服务..."
echo "使用启动类: AuthServiceStandaloneApplication"
echo "配置文件: application-pure.yml"
echo

cd auth-service
java -jar target/auth-service-1.0.0.jar \
    --spring.profiles.active=pure \
    --spring.config.name=application-pure \
    --server.port=8081 \
    --logging.level.com.auth.cloud=debug \
    --logging.level.org.springframework=warn \
    --logging.level.com.alibaba=warn
